<%@ include file="/WEB-INF/views/taglib.jsp" %>
 <c:url value="/stockAdjustment/search" var="paginationUrl"></c:url>
 <div>
 <h3 class="left">Stock Adjustment Search</h3>
 <a href="<c:url value="/stockAdjustment/create" />" class="button right">
	 <img align="absmiddle" src="${imageUrl}/icon_add.png"> Create Stock Adjustment
</a>
 <a onclick="$('.searchCriteria').toggle();" class="button right">
	 <img align="absmiddle" src="${imageUrl}/icon_detail.png">Toggle Search Criteria
</a>
</div>
<div class="clear"></div>
 <form:form id="form" method="get" modelAttribute="searchCriteria" cssClass="simpleForm">
 <div class="searchCriteria">
 <fieldset>
 	<legend>Search Criteria</legend>
	<p class="clearfix">
	<label>
	Stock Adjustment Code 
	</label> 
	<form:input path="search['assetTransactionCode']"/>
	</p>
	
	<p>
	<form:label path="search['dateFrom']" >
	Date From  
	</form:label> 
	<form:input path="search['dateFrom']" id="dateFrom" />
	<input id="button_dateFrom" type="button" class="calendarBtn" />
	</p>
	
	<p>
	<form:label path="search['dateTo']">
	Date To  
	</form:label> 
	<form:input path="search['dateTo']" id="dateTo"/>
	<input id="button_dateTo" type="button" class="calendarBtn" />
	</p>
	
</fieldset>
	<span class="right">
	  	<button type="submit" class="button">Search</button>
	 </span>
 </div>
 </form:form>	
 <div class="clear"></div>
 <fieldset>
 	<legend>Search Result</legend>
 	<c:choose>
 		<c:when test="${searchResult.resultCount==0}">
 		<div class="notice">
 		<span class="ui-icon ui-icon-info left marginright5"></span>
 		No records </div>
 		</c:when>
 	<c:otherwise>
 <table class="gridSearch">
 <thead>	
 	<tr>
 		<th>S/N</th>
 		<th>
 		<aims:sort columnName="assetTransactionSubType" label="Sub Type"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="assetTransactionCode" label="Stock Adjustment Code"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="assetTransactionStatus" label="Status"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="createdBy" label="Modified By"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="dateModified" label="Modified Date"></aims:sort>
 		</th>
 	</tr>
 </thead>
 <tbody>
 	
 	<c:forEach items="${searchResult.result}" var="result" varStatus="status">
 	<tr <c:if test="${(status.count%2)==0 }">class="alt"</c:if>> 
 		<td>${searchResult.recordNo+status.index}</td>
 		<td>
 		${result.assetTransactionSubType}
 		</td>
 		<td>
 		
 			
 		<c:url value="/stockAdjustment/update" var="editUrl"></c:url>
 		<a href="${editUrl}/${result.assetTransactionId}">
 		${result.assetTransactionCode}
 		</a></td>
 		<td>${result.assetTransactionStatus}</td>
 		<td>${result.lastModifiedBy}</td>
 		<td>${result.lastModifiedDate}</td>
 		</tr>
 	</c:forEach>
 	
 </tbody>
 <tfoot>
 	<tr><td colspan="10" align="right">
 		<jsp:include page="/WEB-INF/views/pagination.jsp">
 			<jsp:param name="paginationUrl" value="${paginationUrl}" />
 		</jsp:include>
 	</td></tr>
 </tfoot>
 
 </table>
 </c:otherwise>
 </c:choose>
  </fieldset>
  
  
<script type="text/javascript">
		$(document).ready(function() {
			$('.searchCriteria').hide();
			
			cal = Calendar.setup({
		          onSelect: function(cal) { cal.hide() },
		          showTime: false
		    });
			cal.manageFields("button_dateFrom", "dateFrom", globalJsCalDateFormat);
			cal.manageFields("button_dateTo", "dateTo", globalJsCalDateFormat);
		});
</script>